Micron Document
🎖️GitЯра🎖️


Displaying Raw • Download

feature/settings/src/commonMain/kotlin/org/meshtastic/feature/settings/component/PrivacySection.kt renovate/fastlane-2.x-lockfile (056eed64) Text, 5.92 KB

T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.feature.settings.component

Tff7b72import T7ee787androidx.compose.foundation.layout.ColumnScope
Tff7b72import T7ee787androidx.compose.runtime.Composable
Tff7b72import T7ee787androidx.compose.runtime.LaunchedEffect
Tff7b72import T7ee787androidx.compose.runtime.getValue
Tff7b72import T7ee787androidx.compose.runtime.mutableStateOf
Tff7b72import T7ee787androidx.compose.runtime.remember
Tff7b72import T7ee787androidx.compose.runtime.rememberUpdatedState
Tff7b72import T7ee787androidx.compose.runtime.setValue
Tff7b72import T7ee787org.jetbrains.compose.resources.stringResource
Tff7b72import T7ee787org.meshtastic.core.resources.Res
Tff7b72import T7ee787org.meshtastic.core.resources.analytics_okay
Tff7b72import T7ee787org.meshtastic.core.resources.location_disabled
Tff7b72import T7ee787org.meshtastic.core.resources.location_permission
Tff7b72import T7ee787org.meshtastic.core.resources.location_permission_blocked_toast
Tff7b72import T7ee787org.meshtastic.core.resources.location_permission_rationale
Tff7b72import T7ee787org.meshtastic.core.resources.provide_location_to_mesh
Tff7b72import T7ee787org.meshtastic.core.ui.component.PermissionRationaleDialog
Tff7b72import T7ee787org.meshtastic.core.ui.component.SwitchListItem
Tff7b72import T7ee787org.meshtastic.core.ui.icon.BugReport
Tff7b72import T7ee787org.meshtastic.core.ui.icon.LocationOn
Tff7b72import T7ee787org.meshtastic.core.ui.icon.MeshtasticIcons
Tff7b72import T7ee787org.meshtastic.core.ui.util.PermissionGateAction
Tff7b72import T7ee787org.meshtastic.core.ui.util.isGpsDisabled
Tff7b72import T7ee787org.meshtastic.core.ui.util.permissionGateAction
Tff7b72import T7ee787org.meshtastic.core.ui.util.rememberLocationPermissionState
Tff7b72import T7ee787org.meshtastic.core.ui.util.rememberShowToastResource

T8b949e/** Section managing privacy settings like analytics and location sharing. */
Tf0883e@Composable
Tff7b72internal Tff7b72fun Te6edf3ColumnScopeTb4b4b4.Td2a8ffPrivacySettingsContentTb4b4b4(
Te6edf3analyticsAvailableTb4b4b4: Tffa657BooleanTb4b4b4,
Te6edf3analyticsEnabledTb4b4b4: Tffa657BooleanTb4b4b4,
Te6edf3onToggleAnalyticsTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4,
Te6edf3provideLocationTb4b4b4: Tffa657BooleanTb4b4b4,
Te6edf3onToggleLocationTb4b4b4: Tb4b4b4(Tffa657BooleanTb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4,
Te6edf3homoglyphEnabledTb4b4b4: Tffa657BooleanTb4b4b4,
Te6edf3onToggleHomoglyphTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4,
Te6edf3startProvideLocationTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4,
Te6edf3stopProvideLocationTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4,
Tb4b4b4) Tb4b4b4{
Tff7b72val Te6edf3showToast Tff7b72= Te6edf3rememberShowToastResourceTb4b4b4(Tb4b4b4)
Tff7b72val Te6edf3locationPermission Tff7b72= Te6edf3rememberLocationPermissionStateTb4b4b4(Tb4b4b4)
Tff7b72val Te6edf3isGpsOff Tff7b72= Te6edf3isGpsDisabledTb4b4b4(Tb4b4b4)

T8b949e// Captured through rememberUpdatedState: the effect below restarts on every status change, and reading the
T8b949e// caller's lambdas directly would pin a restarting effect to whichever instances existed when it first ran.
Tff7b72val Te6edf3currentToggleLocation Tff7b72by Te6edf3rememberUpdatedStateTb4b4b4(Te6edf3onToggleLocationTb4b4b4)
Tff7b72val Te6edf3currentStartProvideLocation Tff7b72by Te6edf3rememberUpdatedStateTb4b4b4(Te6edf3startProvideLocationTb4b4b4)
Tff7b72val Te6edf3currentStopProvideLocation Tff7b72by Te6edf3rememberUpdatedStateTb4b4b4(Te6edf3stopProvideLocationTb4b4b4)
Tff7b72val Te6edf3currentShowToast Tff7b72by Te6edf3rememberUpdatedStateTb4b4b4(Te6edf3showToastTb4b4b4)

Tff7b72var Te6edf3showLocationRationale Tff7b72by Te6edf3remember Tb4b4b4{ Te6edf3mutableStateOfTb4b4b4(Tff7b72falseTb4b4b4) Tb4b4b4}

Tff7b72if Tb4b4b4(Te6edf3showLocationRationaleTb4b4b4) Tb4b4b4{
Te6edf3PermissionRationaleDialogTb4b4b4(
Te6edf3titleRes Tff7b72= Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3location_permissionTb4b4b4,
Te6edf3rationaleRes Tff7b72= Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3location_permission_rationaleTb4b4b4,
Te6edf3icon Tff7b72= Te6edf3MeshtasticIconsTb4b4b4.Te6edf3LocationOnTb4b4b4,
Te6edf3onConfirm Tff7b72= Tb4b4b4{
Te6edf3showLocationRationale Tff7b72= Tff7b72false
Te6edf3locationPermissionTb4b4b4.Te6edf3requestTb4b4b4(Tb4b4b4)
Tb4b4b4}Tb4b4b4,
Te6edf3onDismiss Tff7b72= Tb4b4b4{
Te6edf3showLocationRationale Tff7b72= Tff7b72false
T8b949e// The user declined again, so the toggle must not stay on describing something that is not happening.
Te6edf3currentToggleLocationTb4b4b4(Tff7b72falseTb4b4b4)
Tb4b4b4}Tb4b4b4,
Tb4b4b4)
Tb4b4b4}

T8b949e// Keyed on the full status, not just the grant. The previous version called request() for every not-granted case
T8b949e// and noted in a comment that it was "a harmless no-op once permanently denied" — but a no-op is the whole control
T8b949e// when it is the only thing the switch does: it flipped, nothing happened, and nothing said why.
Te6edf3LaunchedEffectTb4b4b4(Te6edf3provideLocationTb4b4b4, Te6edf3locationPermissionTb4b4b4.Te6edf3statusTb4b4b4, Te6edf3isGpsOffTb4b4b4) Tb4b4b4{
Tff7b72if Tb4b4b4(Tff7b72!Te6edf3provideLocationTb4b4b4) Tb4b4b4{
Te6edf3currentStopProvideLocationTb4b4b4(Tb4b4b4)
Tff7b72returnTf0883e@LaunchedEffect
Tb4b4b4}
Tff7b72when Tb4b4b4(Te6edf3permissionGateActionTb4b4b4(Te6edf3locationPermissionTb4b4b4.Te6edf3statusTb4b4b4)Tb4b4b4) Tb4b4b4{
Te6edf3PermissionGateActionTb4b4b4.Te6edf3PROCEED Tff7b72-Tff7b72>
Tff7b72if Tb4b4b4(Tff7b72!Te6edf3isGpsOffTb4b4b4) Te6edf3currentStartProvideLocationTb4b4b4(Tb4b4b4) Tff7b72else Te6edf3currentShowToastTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3location_disabledTb4b4b4)

Te6edf3PermissionGateActionTb4b4b4.Te6edf3REQUEST Tff7b72-Tff7b72> Te6edf3locationPermissionTb4b4b4.Te6edf3requestTb4b4b4(Tb4b4b4)

Te6edf3PermissionGateActionTb4b4b4.Te6edf3SHOW_RATIONALE Tff7b72-Tff7b72> Te6edf3showLocationRationale Tff7b72= Tff7b72true

T8b949e// Requesting here would do nothing at all, so send the user where the switch can actually be honoured and
T8b949e// put it back until it can be.
Te6edf3PermissionGateActionTb4b4b4.Te6edf3OPEN_SETTINGS Tff7b72-Tff7b72> Tb4b4b4{
Te6edf3currentToggleLocationTb4b4b4(Tff7b72falseTb4b4b4)
Te6edf3currentShowToastTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3location_permission_blocked_toastTb4b4b4)
Te6edf3locationPermissionTb4b4b4.Te6edf3openAppSettingsTb4b4b4(Tb4b4b4)
Tb4b4b4}
Tb4b4b4}
Tb4b4b4}

Tff7b72if Tb4b4b4(Te6edf3analyticsAvailableTb4b4b4) Tb4b4b4{
Te6edf3SwitchListItemTb4b4b4(
Te6edf3text Tff7b72= Te6edf3stringResourceTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3analytics_okayTb4b4b4)Tb4b4b4,
Te6edf3checked Tff7b72= Te6edf3analyticsEnabledTb4b4b4,
Te6edf3leadingIcon Tff7b72= Te6edf3MeshtasticIconsTb4b4b4.Te6edf3BugReportTb4b4b4,
Te6edf3onClick Tff7b72= Te6edf3onToggleAnalyticsTb4b4b4,
Tb4b4b4)
Tb4b4b4}

Te6edf3SwitchListItemTb4b4b4(
Te6edf3text Tff7b72= Te6edf3stringResourceTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3provide_location_to_meshTb4b4b4)Tb4b4b4,
Te6edf3leadingIcon Tff7b72= Te6edf3MeshtasticIconsTb4b4b4.Te6edf3LocationOnTb4b4b4,
Te6edf3enabled Tff7b72= Tff7b72!Te6edf3isGpsOffTb4b4b4,
Te6edf3checked Tff7b72= Te6edf3provideLocationTb4b4b4,
Te6edf3onClick Tff7b72= Tb4b4b4{ Te6edf3onToggleLocationTb4b4b4(Tff7b72!Te6edf3provideLocationTb4b4b4) Tb4b4b4}Tb4b4b4,
Tb4b4b4)

Te6edf3HomoglyphSettingTb4b4b4(Te6edf3homoglyphEncodingEnabled Tff7b72= Te6edf3homoglyphEnabledTb4b4b4, Te6edf3onToggle Tff7b72= Te6edf3onToggleHomoglyphTb4b4b4)
Tb4b4b4}

Served by rngit 1.5.4 - Generated in 0.15s